package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;

import com.ruoyi.bizsys.vo.LoanDeferredOrderWebVo;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.LoanDeferredOrderMapper;
import com.ruoyi.bizsys.domain.LoanDeferredOrder;
import com.ruoyi.bizsys.service.ILoanDeferredOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 用户借据延期记录orderService业务层处理
 *
 * @author wqg
 * @date 2022-06-09
 */
@Service
public class LoanDeferredOrderServiceImpl extends ServiceImpl<LoanDeferredOrderMapper,LoanDeferredOrder> implements ILoanDeferredOrderService {

    @Autowired
    LoanDeferredOrderMapper loanDeferredOrderMapper;
    /**
     * 查询用户借据延期记录order
     *
     * @param id 用户借据延期记录orderID
     * @return 用户借据延期记录order
     */
    @Override
    public LoanDeferredOrder selectLoanDeferredOrderById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询用户借据延期记录order列表
     *
     * @param loanDeferredOrder 用户借据延期记录order
     * @return 用户借据延期记录order
     */
    @Override
    public List<LoanDeferredOrderWebVo> selectLoanDeferredOrderList(LoanDeferredOrder loanDeferredOrder) {
        return loanDeferredOrderMapper.selectLoanDeferredOrderList(loanDeferredOrder);
    }

    /**
     * 新增用户借据延期记录order
     *
     * @param loanDeferredOrder 用户借据延期记录order
     * @return 结果
     */
            @Override
    public int insertLoanDeferredOrder(LoanDeferredOrder loanDeferredOrder) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        loanDeferredOrder.setCreateTime(DateUtils.getNowDate());
                                                                    return baseMapper.insert(loanDeferredOrder);
    }

    /**
     * 修改用户借据延期记录order
     *
     * @param loanDeferredOrder 用户借据延期记录order
     * @return 结果
     */
            @Override
    public int updateLoanDeferredOrder(LoanDeferredOrder loanDeferredOrder) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                loanDeferredOrder.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(loanDeferredOrder);
    }

    /**
     * 批量删除用户借据延期记录order
     *
     * @param ids 需要删除的用户借据延期记录orderID
     * @return 结果
     */
            @Override
    public int deleteLoanDeferredOrderByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除用户借据延期记录order信息
     *
     * @param id 用户借据延期记录orderID
     * @return 结果
     */
    @Override
    public int deleteLoanDeferredOrderById(Long id) {
        return baseMapper.deleteById(id);
    }

}
